package mylibrary.serialize;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Output {

	public static void main(String[] args) throws Exception {

		write();
		read();
	}

	
	
	
	public static void write() throws IOException {

		FileOutputStream fos = new FileOutputStream("c:\\temp.out");

		ObjectOutputStream oos = new ObjectOutputStream(fos);

		TestSerial test = new TestSerial();

		oos.writeObject(test);

		oos.flush();
		oos.close();
	}
	
	public static void read() throws IOException, ClassNotFoundException {
		
		FileInputStream fis = new FileInputStream("c:\\temp.out");
		
		ObjectInputStream ois = new ObjectInputStream(fis);
		
		TestSerial test = (TestSerial) ois.readObject();
		
		System.out.println(test.getVersion());
		
	}
}
